package cn.ustb.serviceImpl;

import cn.ustb.dao.OptionalCourseDao;
import cn.ustb.entity.OptionalCourse;
import cn.ustb.service.OptionalCourseService;
import cn.ustb.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author yuyan
 */
public class OptionalCourseServiceImpl implements OptionalCourseService {
    @Override
    public List<OptionalCourse> getAllWithYearTerm(String yearTerm) {
        SqlSession sqlSession=null;
        try{
            sqlSession = MyBatisUtil.getInstance();
            OptionalCourseDao optionalCourseDao = sqlSession.getMapper(OptionalCourseDao.class);
            return optionalCourseDao.getAllWithYearTerm(yearTerm);
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if (sqlSession!=null){
                sqlSession.close();
            }
        }
        return null;
    }
}
